package com.mmy.controller.plane;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.mmy.controller.Common;
import com.mmy.controller.UtilConstants;
import com.mmy.domain.plane.TPlaneOrder;
import com.mmy.domain.plane.TPlanePlan;
import com.mmy.domain.plane.VPlaneBase;
import com.mmy.domain.plane.VPlaneOrder;
import com.mmy.domain.plane.VPlanePlan;
import com.mmy.domain.scenic.VScenicOrder;
import com.mmy.domain.sys.TSysUser;
import com.mmy.service.plane.impl.PlaneBaseServiceImpl;
import com.mmy.service.plane.impl.PlaneOrderServiceImpl;
import com.mmy.service.plane.impl.PlanePlanServiceImpl;
import com.mmy.service.plane.impl.TPlaneBaseServiceImpl;
import com.mmy.service.plane.impl.TPlaneOrderServiceImpl;
import com.mmy.service.plane.impl.TPlanePlanServiceImpl;
import com.mmy.service.scenic.impl.ScenicOrderServiceImpl;

/**
 * 类的介绍：机票订单
 *
 * @author shangzl
 * @date 创建日期：
 * @version 1.0
 */
@Controller
public class PlaneOrderController {

	@Autowired
	PlaneOrderServiceImpl planeOrderServiceImpl;
	@Autowired
	PlaneBaseServiceImpl planeBaseServiceImpl;
	@Autowired
	PlanePlanServiceImpl planePlanServiceImpl;
	@Autowired
	ScenicOrderServiceImpl scenicOrderServiceImpl;
	@Autowired
	Common common;
	@Autowired
	TPlanePlanServiceImpl tPlanePlanServiceImpl;
	@Autowired
	TPlaneOrderServiceImpl tPlaneOrderServiceImpl;
	@Autowired
	TPlaneBaseServiceImpl tPlaneBaseServiceImpl;

	/**
	 * 函数功能说明：后台显示所有飞机票订单信息
	 *
	 * @param 参数说明 tScenicOrder
	 * @return 返回值说明 jsp页面
	 * @author 创建人 hanxl 整理
	 * @date 创建日期 2020.12.29
	 */

	@RequestMapping(value = "/toplaneallorderindex")
	public String toPlaneOrderIndex(HttpServletRequest request, Model model, HttpSession session) {
		TSysUser sessionSysUser = (TSysUser) session.getAttribute("tSysUser");
		List<VPlaneOrder> lstPlaneOrder = new ArrayList<VPlaneOrder>();
		// 管理员登录 默认查看所有
		if (sessionSysUser.getUserID() == 0) {
			lstPlaneOrder = planeOrderServiceImpl.findBySeachAdministrator();
		} else {
			// 非管理员登录 默认查看自家公司的景区所有订单 以及订单操作人是自己公司的订单
			// 搜索时 输入搜索条件同时满足上述条件
			lstPlaneOrder = planeOrderServiceImpl.findBySearchOperator(sessionSysUser);
		}
		model.addAttribute("lstPlaneOrder", lstPlaneOrder);
		return "webbackground/plane/PlaneAllOrderIndex";
	}

	@RequestMapping(value = "/backplaneorderjson")
	@ResponseBody
	public String backPlaneOrderJson(HttpServletRequest request, Model model, HttpSession session) {
		// 接收的分页信息处理
		int page = Integer.parseInt(request.getParameter("page"));
		int rows = Integer.parseInt(request.getParameter("rows"));
		int startIndex = (page - 1) * rows;
		int count = rows;
		TSysUser sessionSysUser = (TSysUser) session.getAttribute("tSysUser");
		String strPlaneName = request.getParameter("strPlaneName");
		String strOrderName = request.getParameter("strOrderName");
		String strOrderTel = request.getParameter("strOrderTel");
		String strOrderDate = request.getParameter("strOrderDate");
		String strOrderState = request.getParameter("strOrderState");

		List<VPlaneOrder> lstPlaneOrder = new ArrayList<VPlaneOrder>();
		int total = 0;
		// 管理员登录 默认查看所有 并分页 带搜索条件
		if (sessionSysUser.getUserID() == 0) {
			lstPlaneOrder = planeOrderServiceImpl.findSearchByAdministrator(strPlaneName, strOrderName, strOrderTel,
					strOrderDate, strOrderState, startIndex, count);
			total = planeOrderServiceImpl.queryOrderAdminCount(strPlaneName, strOrderName, strOrderTel, strOrderDate,
					strOrderState);

		} else {
			// 非管理员登录 默认查看自家公司的景区所有订单 以及订单操作人是自己公司的订单
			// 搜索时 输入搜索条件同时满足上述条件
			lstPlaneOrder = planeOrderServiceImpl.findSearchByOperator(strPlaneName, strOrderName, strOrderTel,
					strOrderDate, strOrderState, sessionSysUser, startIndex, count);
			total = planeOrderServiceImpl.queryOrderCount(strPlaneName, strOrderName, strOrderTel, strOrderDate,
					strOrderState, sessionSysUser);

		}

		model.addAttribute("lstPlaneOrder", lstPlaneOrder);

		Map<String, Object> ret = new HashMap<String, Object>();
		ret.put("rows", lstPlaneOrder);
		ret.put("total", total);
		return JSONObject.toJSONString(ret);
	}

	/**
	 * 函数功能说明：后台显示未使用的订单信息
	 *
	 * @param 参数说明
	 * @return 返回值说明 jsp页面
	 * @author 创建人 hanxl 整理
	 * @date 创建日期 2020.12.29
	 */
	@RequestMapping(value = "/toplaneunusedorderindex")
	public String toPlaneUnUsedOrderIndex(HttpServletRequest request, Model model, String pageNumber, String pageSize,
			HttpSession session) {

		TSysUser sessionSysUser = (TSysUser) session.getAttribute("tSysUser");
		String strScenicName = request.getParameter("strScenicName");
		String strOrderName = request.getParameter("strOrderName");
		String strOrderTel = request.getParameter("strOrderTel");
		String strOrderDate = request.getParameter("strOrderDate");
		List<VScenicOrder> lstScenicOrder = new ArrayList<VScenicOrder>();
		HashMap<String, Integer> mapPage = new HashMap<String, Integer>();

		// 管理员登录 默认查看所有 并分页 带搜索条件
		if (sessionSysUser.getUserID() == 0) {
			lstScenicOrder = scenicOrderServiceImpl.findBySeachAdministratorUnUsed(pageNumber, pageSize, strScenicName,
					strOrderName, strOrderTel, strOrderDate);
			mapPage = scenicOrderServiceImpl.mapSeachAdministratorUnUsed(pageNumber, pageSize, strScenicName,
					strOrderName, strOrderTel, strOrderDate);
		} else {
			// 非管理员登录 默认查看自家公司的景区所有订单 以及订单操作人是自己公司的订单
			// 搜索时 输入搜索条件同时满足上述条件
			lstScenicOrder = scenicOrderServiceImpl.findBySearchOperatorUnUsed(pageNumber, pageSize, strScenicName,
					strOrderName, strOrderTel, strOrderDate, sessionSysUser);
			mapPage = scenicOrderServiceImpl.mapSearchOperatorUnUsed(pageNumber, pageSize, strScenicName, strOrderName,
					strOrderTel, strOrderDate, sessionSysUser);
		}

		model.addAttribute("lstScenicOrder", lstScenicOrder);

		model.addAttribute("iPageNo", mapPage.get("iPageNo"));
		model.addAttribute("iTotalCount", mapPage.get("iTotalCount"));
		model.addAttribute("iMaxPage", mapPage.get("iMaxPage"));
		model.addAttribute("iPageSize", mapPage.get("iPageSize"));
		model.addAttribute("strScenicName", strScenicName);
		model.addAttribute("strOrderName", strOrderName);
		model.addAttribute("strOrderTel", strOrderTel);
		model.addAttribute("strOrderDate", strOrderDate);
		return "webbackground/plane/PlaneUnUsedOrderIndex";
	}

	/**
	 * 函数功能说明： 新建机票预留信息
	 *
	 * @param 参数说明
	 * @return 返回值说明 jsp页面
	 * @throws 异常处理说明
	 * @author 创建人 shangzl
	 * @date 创建日期
	 */

	@RequestMapping(value = "/enterreserveplanebase")
	public String EnterReservePlaneBase(HttpServletRequest request, Model model) {

		int iPlaneID = Integer.parseInt(request.getParameter("iPlaneID"));

		List<VPlanePlan> lstPlanePlan = tPlanePlanServiceImpl.findByPlaneID(iPlaneID);
		model.addAttribute("planeplanlist", lstPlanePlan);

		model.addAttribute("iPlaneID", iPlaneID);

		return "webbackground/plane/reserveplanebase";

	}

	@RequestMapping(value = "/subreserveplanebase")
	public String ReservePlaneBase(TPlaneOrder tPlaneOrder, HttpSession session, String strPlanID, String PlaneID)
			throws Exception {
		// 获取最大ID
		tPlaneOrder.setID(common.createMaxID(UtilConstants.TableName.T_PLANE_ORDER));

		// 获得订单编号
		int iPlanID = Integer.parseInt(strPlanID);
		String cOrderID = common.createOrderCode(UtilConstants.TableName.T_PLANE_ORDER, iPlanID);

		try {
			TPlanePlan tPlanePlan = tPlanePlanServiceImpl.findByPlanID(iPlanID);
			tPlaneOrder.setCreateDate(new Date());
			tPlaneOrder.setReserveDate(new Date());
			tPlaneOrder.setFloor(tPlanePlan.getFloor());
			tPlaneOrder.setPeer(tPlanePlan.getPeer());
			tPlaneOrder.setPrice(tPlanePlan.getPrice());
			BigDecimal bPrice = tPlanePlan.getPrice();
			tPlaneOrder.setOrderAmount(bPrice);
			TSysUser tSysUser = (TSysUser) session.getAttribute("tSysUser");
			tPlaneOrder.setCreator(tSysUser.getUserName());
			tPlaneOrder.setReserveUserID(tSysUser.getUserID());
			tPlaneOrder.setOrderID(cOrderID);
			tPlaneOrderServiceImpl.save(tPlaneOrder.getID());
			tPlaneOrder.setOrderState((byte) 0);
			tPlaneOrder.setCashierState((byte) 0);
			tPlaneOrder.setAccountState((byte) 0);
			tPlaneOrder.setInvoiceState((byte) 0);
			tPlaneOrder.setRefundState((byte) 0);
			tPlaneOrder.setRemittanceState((byte) 0);
			tPlaneOrderServiceImpl.save(tPlaneOrder);
			return "redirect:planebaseinfo?iPlaneID=" + Integer.parseInt(PlaneID);

		} catch (Exception e) {

		}
		return null;

	}

	/**
	 * 函数功能说明： 预留转订单信息
	 *
	 * @param 参数说明
	 * @return 返回值说明 jsp页面
	 * @throws 异常处理说明
	 * @author 创建人 shangzl
	 * @date 创建日期
	 */

	@RequestMapping(value = "/enterpayorderplane")
	public String EnterPayOrderPlane(HttpServletRequest request, Model model) {

		int iID = Integer.parseInt(request.getParameter("iID"));
		TPlaneOrder tPlaneOrder = tPlaneOrderServiceImpl.findByID(iID);
		model.addAttribute("tPlaneOrder", tPlaneOrder);

		int iPlaneID = Integer.parseInt(request.getParameter("iPlaneID"));
		model.addAttribute("iPlaneID", iPlaneID);

		return "webbackground/plane/payorderplane";

	}

	@RequestMapping(value = "/subpayorderplane")
	public String PayOrderPlane(TPlaneOrder tPlaneOrder, HttpSession session, String PlaneID) throws Exception {

		try {
//			 定义一个新的实体类对象 
			TPlaneOrder dtPlaneOrder = tPlaneOrderServiceImpl.findByID(tPlaneOrder.getID());

			dtPlaneOrder.setPayType(tPlaneOrder.getPayType());
			dtPlaneOrder.setOrderState((byte) 2);
			dtPlaneOrder.setOrderDate(new Date());
			dtPlaneOrder.setOrderName(tPlaneOrder.getOrderName());
			dtPlaneOrder.setOrderTel(tPlaneOrder.getOrderTel());
			TSysUser tSysUser = (TSysUser) session.getAttribute("tSysUser");
			dtPlaneOrder.setOrderUserID(tSysUser.getUserID());
			dtPlaneOrder.setReceivable(tPlaneOrder.getReceivable());
			dtPlaneOrder.setVoucher(tPlaneOrder.getVoucher());
			dtPlaneOrder.setReceipt(tPlaneOrder.getReceipt());
			tPlaneOrderServiceImpl.save(dtPlaneOrder);

			return "redirect:printplane?iID=" + tPlaneOrder.getID();

		} catch (Exception e) {

		}
		return null;

	}

	/**
	 * 函数功能说明： 取消订单
	 *
	 * @param 参数说明
	 * @return 返回值说明 jsp页面
	 * @throws 异常处理说明
	 * @author 创建人 shangzl
	 * @date 创建日期
	 */

	@RequestMapping(value = "/entercancelorderplane")
	public String EnterCancelOrderPlane(HttpServletRequest request, Model model) {

		int iID = Integer.parseInt(request.getParameter("iID"));
		TPlaneOrder tPlaneOrder = tPlaneOrderServiceImpl.findByID(iID);
		model.addAttribute("tPlaneOrder", tPlaneOrder);

		int iPlaneID = Integer.parseInt(request.getParameter("iPlaneID"));
		model.addAttribute("iPlaneID", iPlaneID);

		return "webbackground/plane/cancelorderplane";

	}

	@RequestMapping(value = "/subcancelorderplane")
	public String CancelOrderPlane(TPlaneOrder tPlaneOrder, HttpSession session, String PlaneID) throws Exception {

		try {
//			 定义一个新的实体类对象 
			TPlaneOrder dtPlaneOrder = tPlaneOrderServiceImpl.findByID(tPlaneOrder.getID());

			dtPlaneOrder.setOrderState((byte) 4);
			dtPlaneOrder.setRefund(tPlaneOrder.getRefund());
			tPlaneOrderServiceImpl.save(dtPlaneOrder);

			return "redirect:printcancelplane?iID=" + tPlaneOrder.getID();

		} catch (Exception e) {

		}
		return null;

	}

	/**
	 * 函数功能说明： 修改机票预留信息
	 *
	 * @param 参数说明
	 * @return 返回值说明 jsp页面
	 * @throws 异常处理说明
	 * @author 创建人 shangzl
	 * @date 创建日期
	 */

	@RequestMapping(value = "/enterupdatereserveplane")
	public String EnterUpdateReservePlane(HttpServletRequest request, Model model) {

		int iID = Integer.parseInt(request.getParameter("iID"));

		TPlaneOrder tPlaneOrder = tPlaneOrderServiceImpl.findByID(iID);
		model.addAttribute("tPlaneOrder", tPlaneOrder);
		int iPlaneID = Integer.parseInt(request.getParameter("iPlaneID"));
		model.addAttribute("iPlaneID", iPlaneID);

		return "webbackground/plane/updatereserveplane";

	}

	@RequestMapping(value = "/updatereserveplane")
	public String UpdateReservePlaneBase(TPlaneOrder tPlaneOrder, HttpSession session, String PlaneID)
			throws Exception {
		try {
//			 定义一个新的实体类对象 
			TPlaneOrder dtPlaneOrder = tPlaneOrderServiceImpl.findByID(tPlaneOrder.getID());
			dtPlaneOrder.setReserveName(tPlaneOrder.getReserveName());
			dtPlaneOrder.setReserveTel(tPlaneOrder.getReserveTel());
			dtPlaneOrder.setMemo(tPlaneOrder.getMemo());
			dtPlaneOrder.setModifyDate(new Date());
			BigDecimal bPrice = dtPlaneOrder.getPrice();
			dtPlaneOrder.setOrderAmount(bPrice);
			TSysUser tSysUser = (TSysUser) session.getAttribute("tSysUser");
			dtPlaneOrder.setReviser(tSysUser.getUserName());
			tPlaneOrderServiceImpl.save(dtPlaneOrder);
			return "redirect:planebaseinfo?iPlaneID=" + Integer.parseInt(PlaneID);

		} catch (Exception e) {

		}
		return null;
	}

	/**
	 * 函数功能说明： 取消预留
	 *
	 * @param 参数说明
	 * @return 返回值说明 jsp页面
	 * @throws 异常处理说明
	 * @author 创建人 shangzl
	 * @date 创建日期
	 */

	@RequestMapping(value = "/entercancelreserveplane")
	public String CancelReservePlane(HttpServletRequest request, Model model) {

		int iID = Integer.parseInt(request.getParameter("iID"));

		TPlaneOrder tPlaneOrder = tPlaneOrderServiceImpl.findByID(iID);

		tPlaneOrder.setOrderState((byte) 3);

		tPlaneOrderServiceImpl.save(tPlaneOrder);

		model.addAttribute("tPlaneOrder", tPlaneOrder);
		int iPlaneID = Integer.parseInt(request.getParameter("iPlaneID"));
		model.addAttribute("iPlaneID", iPlaneID);

		VPlaneBase vPlaneBase = tPlaneBaseServiceImpl.findByID(iPlaneID);
		model.addAttribute("vPlaneBase", vPlaneBase);

		List<VPlaneOrder> lstPlaneOrder = tPlaneOrderServiceImpl.findByPlaneID(iPlaneID);
		model.addAttribute("orderlist", lstPlaneOrder);

		return "webbackground/plane/planebaseinfo";

	}

	/**
	 * 函数功能说明： 修改机票订单信息
	 *
	 * @param 参数说明
	 * @return 返回值说明 jsp页面
	 * @throws 异常处理说明
	 * @author 创建人 shangzl
	 * @date 创建日期
	 */

	@RequestMapping(value = "/enterupdateorderplane")
	public String EnterUpdateOrderPlane(HttpServletRequest request, Model model) {

		int iID = Integer.parseInt(request.getParameter("iID"));

		TPlaneOrder tPlaneOrder = tPlaneOrderServiceImpl.findByID(iID);
		model.addAttribute("tPlaneOrder", tPlaneOrder);
		int iPlaneID = Integer.parseInt(request.getParameter("iPlaneID"));
		model.addAttribute("iPlaneID", iPlaneID);

		return "webbackground/plane/updateorderplane";

	}

	@RequestMapping(value = "/updateorderplane")
	public String UpdateOrderPlaneBase(TPlaneOrder tPlaneOrder, HttpSession session, String PlaneID) throws Exception {
		try {
//			 定义一个新的实体类对象 
			TPlaneOrder dtPlaneOrder = tPlaneOrderServiceImpl.findByID(tPlaneOrder.getID());
			dtPlaneOrder.setOrderName(tPlaneOrder.getOrderName());
			dtPlaneOrder.setOrderTel(tPlaneOrder.getOrderTel());
			dtPlaneOrder.setMemo(tPlaneOrder.getMemo());
			dtPlaneOrder.setModifyDate(new Date());

			BigDecimal bPrice = dtPlaneOrder.getPrice();

			dtPlaneOrder.setOrderAmount(bPrice);
			TSysUser tSysUser = (TSysUser) session.getAttribute("tSysUser");
			dtPlaneOrder.setReviser(tSysUser.getUserName());
			tPlaneOrderServiceImpl.save(dtPlaneOrder);
			return "redirect:planebaseinfo?iPlaneID=" + Integer.parseInt(PlaneID);

		} catch (Exception e) {

		}
		return null;
	}

	/**
	 * 函数功能说明： 删除取消预留信息
	 *
	 * @param 参数说明
	 * @return 返回值说明 jsp页面
	 * @throws 异常处理说明
	 * @author 创建人 shangzl
	 * @date 创建日期
	 */

	@RequestMapping(value = "/delreserveplanebase")
	public String DelReservePlaneBase(String checkList, HttpServletRequest request, Model model) {

		String[] checklist = checkList.split(",");
		List<Integer> lstID = new ArrayList<>();

		for (String str : checklist) {
			lstID.add(Integer.parseInt(str));
		}

		tPlaneOrderServiceImpl.delPlaneOrder(lstID);

		int iPlaneID = Integer.parseInt(request.getParameter("iPlaneID"));
		model.addAttribute("iPlaneID", iPlaneID);
		VPlaneBase vPlaneBase = tPlaneBaseServiceImpl.findByID(iPlaneID);
		model.addAttribute("vPlaneBase", vPlaneBase);

		List<VPlaneOrder> lstPlaneOrder = tPlaneOrderServiceImpl.findByPlaneID(iPlaneID);
		model.addAttribute("orderlist", lstPlaneOrder);

		return "webbackground/plane/planebaseinfo";
	}

	/**
	 * 函数功能说明： 删除取消订单信息
	 *
	 * @param 参数说明
	 * @return 返回值说明 jsp页面
	 * @throws 异常处理说明
	 * @author 创建人 shangzl
	 * @date 创建日期
	 */

	@RequestMapping(value = "/delorderplanebase")
	public String DelOrderPlaneBase(String checkList, HttpServletRequest request, Model model) {

		String[] checklist = checkList.split(",");
		List<Integer> lstID = new ArrayList<>();

		for (String str : checklist) {
			lstID.add(Integer.parseInt(str));
		}

		tPlaneOrderServiceImpl.delPlaneOrder(lstID);

		int iPlaneID = Integer.parseInt(request.getParameter("iPlaneID"));
		model.addAttribute("iPlaneID", iPlaneID);

		VPlaneBase vPlaneBase = tPlaneBaseServiceImpl.findByID(iPlaneID);
		model.addAttribute("vPlaneBase", vPlaneBase);

		List<VPlaneOrder> lstPlaneOrder = tPlaneOrderServiceImpl.findByPlaneID(iPlaneID);
		model.addAttribute("orderlist", lstPlaneOrder);

		return "webbackground/plane/planebaseinfo";
	}

	/**
	 * 函数功能说明： 前台个人中心点击取机票预留
	 *
	 * @param 参数说明 tSysUser:用户类 用户 session
	 * @return 返回值说明 jsp页面
	 * @throws 异常处理说明
	 * @author 创建人 hanxl
	 * @date 创建日期 2020.10.29
	 */
	@RequestMapping(value = "/enterplanecancelreserve")
	public String enterPlaneCancelReserve(HttpServletRequest request, HttpSession session) {

		int iID = Integer.parseInt(request.getParameter("iID"));
		TSysUser sessionSysUser = (TSysUser) session.getAttribute("tSysUser");
		planeOrderServiceImpl.updateState(iID, sessionSysUser);
		return "redirect:myplanereserve";
	}

	/**
	 * 函数功能说明： 前台个人中心点击申请机票退单
	 *
	 * @param 参数说明 tSysUser:用户类 用户 session
	 * @return 返回值说明 jsp页面
	 * @throws 异常处理说明
	 * @author 创建人 hanxl
	 * @date 创建日期 2020.10.29
	 */
	@RequestMapping(value = "/enterplaneapplyrefund")
	public String enterPlaneApplyRefund(HttpServletRequest request, HttpSession session) {

		int iID = Integer.parseInt(request.getParameter("iID"));
		TSysUser sessionSysUser = (TSysUser) session.getAttribute("tSysUser");
		planeOrderServiceImpl.updateRefundState(iID, sessionSysUser);
		return "redirect:myplaneorder";
	}

	/**
	 * 函数功能说明： 前台个人中心点击撤销机票退单
	 *
	 * @param 参数说明 tSysUser:用户类 用户 session
	 * @return 返回值说明 jsp页面
	 * @throws 异常处理说明
	 * @author 创建人 hanxl
	 * @date 创建日期 2020.10.29
	 */
	@RequestMapping(value = "/enterplanecancelrefund")
	public String enterPlaneCancelRefund(HttpServletRequest request, HttpSession session) {

		int iID = Integer.parseInt(request.getParameter("iID"));
		TSysUser sessionSysUser = (TSysUser) session.getAttribute("tSysUser");
		planeOrderServiceImpl.updateCancelState(iID, sessionSysUser);
		return "redirect:myplanerefund";
	}

	/* 前台个人中心显示订单详情 */
	@RequestMapping(value = "/myplaneinfo")
	public String toMyPlaneInfo(HttpServletRequest request, Model model) {

		int iID = Integer.parseInt(request.getParameter("iID"));

		TPlaneOrder dbPlaneOrder = planeOrderServiceImpl.findByID(iID);
		model.addAttribute("dbPlaneOrder", dbPlaneOrder);

		String strOrderID = dbPlaneOrder.getOrderID();
		int iPlanID = Integer.parseInt(strOrderID.substring(6, 12));

		VPlanePlan dbPlanePlan = planePlanServiceImpl.findByID(iPlanID);

		model.addAttribute("dbPlanePlan", dbPlanePlan);

		return "permanagement/MyPlaneInfo";
	}
}
